package CommonEvent;

/**
 * @author 锄禾
 * @projectName MkPack
 * @description: MonkeyXpathEvent Event抽象类
 */

/**
 *     public static final int EVENT_TYPE_KEY = 0;
 *     public static final int EVENT_TYPE_TOUCH = 1;
 *     public static final int EVENT_TYPE_TRACKBALL = 2;
 *     public static final int EVENT_TYPE_ROTATION = 3;  // Screen rotation
 *     public static final int EVENT_TYPE_ACTIVITY = 4;
 *     public static final int EVENT_TYPE_FLIP = 5; // Keyboard flip
 *     public static final int EVENT_TYPE_THROTTLE = 6;
 *     public static final int EVENT_TYPE_PERMISSION = 7;
 *     public static final int EVENT_TYPE_NOOP = 8;
 *
 * */

public abstract class MonkeyEvent {
    protected int eventType;

    public static final int EVENT_TYPE_TAP = 0;
    public static final int EVENT_TYPE_SWIPE = 1;
    public static final int EVENT_TYPE_LAUNCH = 2;
    public static final int EVENT_TYPE_BACK = 3;
    public static final int EVENT_TYPE_SUBMIT = 4;
    public static final int EVENT_TYPE_CONTENT = 5;
    public static final int EVENT_TYPE_HOMEKEY = 6;

    public static final int INJECT_SUCCESS = 1;
    public static final int INJECT_FIAL = 0;


    public static final int INJECT_ERROR_REMOTE_EXCEPTION = -1;
    public static final int INJECT_ERROR_SECURITY_EXCEPTION = -2;

    public MonkeyEvent(int type){
        eventType = type;
    }

    /**
    　* @author 锄禾
    　* @description: TODO
    　* @param
    　* @return  event type
    　*/
    public int getEventType(){
        return eventType;
    }

    /**
    　* @author 锄禾
    　* @description: TODO
    　* @param
    　* @return  此事件流安全的话，返回true，反之返回false
    　*/
    public boolean isThrottlable(){
        return true;
    }

    /**
    　* @author 锄禾
    　* @description: 注入事件的抽象方法
    　* @param
    　* @return 1、成功：pass，失败：返回错误码
    　*/
    public abstract int injectEvent() throws Exception;

}
